/*
 * @Author: 颜礼田 2564217790@qq.com
 * @Date: 2024-09-10 11:05:38
 * @LastEditors: 颜礼田 2564217790@qq.com
 * @LastEditTime: 2024-09-10 11:21:06
 * @FilePath: /webServerAdmin/src/api/modules/article_category.ts
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import http from "@/api";
import { PORT1 } from "@/api/config/servicePort";
import { ArticleCategorySchema } from "@/schema";
import { Id } from "../interface";

export function saveArticleCategory(data: ArticleCategorySchema) {
  return http.post<ArticleCategorySchema>(`${PORT1}/article_category/save`, data);
}

export function fetchArticleCategoryTrees() {
  return http.get<{ list: Array<ArticleCategorySchema> }>(`${PORT1}/article_category/trees`);
}

export function fetchArticleCategoryInfo(params: Id) {
  return http.get<ArticleCategorySchema>(`${PORT1}/article_category/info`, params);
}

export function removeArticleCategory(params: Id) {
  return http.delete<ArticleCategorySchema>(`${PORT1}/article_category/remove`, params);
}

export function editArticleCategory(params: Id, data: ArticleCategorySchema) {
  return http.put<ArticleCategorySchema>(`${PORT1}/article_category/edit`, data, { params });
}
